package dao;


import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

import model.Employee;



public class EmployeeDao {
	
	//insert
	public int insert(Employee employee) {
		// TODO 自动生成的方法存根
		//定义新增员工的sql语句
		String sql="INSERT into employee(employeename,username,password,phone,email,status,departmentid,role) values(?,?,?,?,?,0,?,?) ";
		//定义参数列表
		List params=new ArrayList<>();
		//给参数列表赋值
		params.add(employee.getEmployeename());
		params.add(employee.getUsername());
		params.add(employee.getPassword());
		params.add(employee.getPhone());
		params.add(employee.getEmail());
		params.add(employee.getDepartmentid());
		params.add(employee.getRole());
		return JDBCUtil.execStatement(sql, params);
	}
	//update
	
	//delete
	
	//select
	public ResultSet selectByUsername(String sql,List params) {
		
		//执行查询，返回结果集rSet
		ResultSet rSet=JDBCUtil.execQuery(sql, params);
		return rSet;
	}

}
